function saveToken(){
    let param = location.search;
      let reg = /token/;
      if(reg.test(param)){
          if (param.indexOf("?") != -1) {  
            let str = param.substr(1);
            let accessToken = str.replace("token",'');
            if(sessionStorage.getItem("token")){
                sessionStorage.removeItem('token')
                sessionStorage.setItem('token',accessToken)
            }else {
                sessionStorage.setItem('token',accessToken)
            }
          }
      }else {
        let url= window.location.href;
        window.location.href = 'http://api.xheme.com/api/wechatofficial/1/login?url='+ url;
        
      }
}



export default {
    saveToken
}